<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>true,
	'htmlOptions' => array('enctype'=>'multipart/form-data'),
));
?>

	<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

	<?php echo $form->errorSummary(array($model,$profile)); ?>
	
	
	<div class="col-md-8">
	
	<div class="panel panel-primary">
			<div class="panel-heading">
				 <h3 class="panel-title"><span class="glyphicon glyphicon-book"></span>&nbsp;&nbsp;Crear un nuevo usuario</h3>
	
			</div>
	<div class="panel-body">
	
		<div class="form-group">
	<?php echo $form->labelEx($model,'username'); ?>
    <?php echo $form->textField($model,'username',array('class'=>'form-control', 'size'=>60,'maxlength'=>300, 'placeholder'=>' ')); ?>
     <?php echo $form->error($model,'username',array('class'=>'text-danger')); ?>	
	</div>
	
	<div class="form-group">
	<?php echo $form->labelEx($model,'password'); ?>
	<?php echo $form->passwordField($model,'password',array('class'=>'form-control', 'size'=>60,'maxlength'=>300, 'placeholder'=>' ')); ?> 	
    <?php echo $form->error($model,'password',array('class'=>'text-danger')); ?>	
     </div>
  
	<div class="form-group">
	<?php echo $form->labelEx($model,'email'); ?>
    <?php echo $form->textField($model,'email',array('class'=>'form-control', 'size'=>60,'maxlength'=>300, 'placeholder'=>'E-mail')); ?>
     <?php echo $form->error($model,'email',array('class'=>'text-danger')); ?>	
	</div>
	
	
	
		<div class="form-group">
 	<?php echo $form->labelEx($model,'superuser'); ?> 		
	<?php echo $form->dropDownList($model,'superuser',User::itemAlias('AdminStatus'),array('class'=>'form-control')); ?> 		
			
    <?php echo $form->error($model,'superuser'); ?>
    </div>
	
	
	
	
	<div class="form-group">
     <?php echo $form->labelEx($model,'status'); ?> 		
	<?php echo $form->dropDownList($model,'status',User::itemAlias('UserStatus'),array('class'=>'form-control')); ?> 		
 	<?php echo $form->error($model,'status'); ?> 		
 	</div>

	

	<div class="form-group">
<?php 
		$profileFields=$profile->getFields();
		if ($profileFields) {
			foreach($profileFields as $field) {
			?>
	
		<?php echo $form->labelEx($profile,$field->varname); ?>
		<?php 
		if ($widgetEdit = $field->widgetEdit($profile)) {
			echo $widgetEdit;
		} elseif ($field->range) {
			echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));
		} elseif ($field->field_type=="TEXT") {
			echo CHtml::activeTextArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
		} else {
			echo $form->textField($profile,$field->varname,array('class'=>'form-control', 'size'=>60,'maxlength'=>300, 'placeholder'=>''));
		}
		 ?>
		<?php echo $form->error($profile,$field->varname); ?>
	
			<?php
			}
		}
?>
</div>
	<div class="panel-body">	
				<button type="submit" class="btn btn-primary"><?php echo ($model->isNewRecord)? 'Crear': 'Guardar';?></button>
			</div>	
			</div>
			
			</div>

<?php $this->endWidget(); ?>
</div>
</div><!-- form -->